@echo off setlocal EnableDelayedExpansion :: ============================================================ :: AccessDatabaseEngine Silent Installer :: Runs AccessRuntime_x86_en-us.exe /passive as Administrator :: ============================================================ title Access Database Engine Installer :: ---------------------------------------------------------- :: Step 1: Get the directory where THIS batch file lives :: ---------------------------------------------------------- set "SCRIPT_DIR=%~dp0" set "INSTALLER=%SCRIPT_DIR%AccessRuntime_x86_en-us.exe" :: ---------------------------------------------------------- :: Step 2: Check if the installer exists :: ---------------------------------------------------------- if not exist "%INSTALLER%" ( echo. echo [ERROR] File not found: echo %INSTALLER% echo. echo Place AccessRuntime_x86_en-us.exe in the same folder as this script. echo. pause exit /b 1 ) :: ---------------------------------------------------------- :: Step 3: Re-launch as Administrator if not already elevated :: ---------------------------------------------------------- net session >nul 2>&1 if %errorlevel% neq 0 ( echo Requesting Administrator privileges... powershell -NoProfile -Command ^ "Start-Process -FilePath '%~f0' -Verb RunAs -Wait" exit /b ) :: ---------------------------------------------------------- :: Step 4: Run the installer (we ARE administrator at this point) :: ---------------------------------------------------------- echo. echo ============================================================ echo Access Database Engine Installer echo ============================================================ echo. echo Installer : %INSTALLER% echo Arguments : /passive echo Status : Running... echo. :: Launch and wait for completion "%INSTALLER%" /passive set "EXIT_CODE=!errorlevel!" :: ---------------------------------------------------------- :: Step 5: Report result :: ---------------------------------------------------------- echo. if !EXIT_CODE! equ 0 ( echo ============================================================ echo [SUCCESS] Installation completed successfully. echo Exit Code: !EXIT_CODE! echo ============================================================ ) else if !EXIT_CODE! equ 1638 ( echo ============================================================ echo [INFO] A newer version is already installed. No changes made. echo Exit Code: !EXIT_CODE! echo ============================================================ ) else if !EXIT_CODE! equ 3010 ( echo ============================================================ echo [SUCCESS] Installation succeeded - Restart required. echo Exit Code: !EXIT_CODE! echo ============================================================ ) else ( echo ============================================================ echo [FAILURE] Installation failed. echo Exit Code: !EXIT_CODE! echo. echo Common codes: echo 1603 - Fatal error during installation echo 1618 - Another install already in progress echo 1638 - Newer version already installed echo ============================================================ ) echo. pause exit /b !EXIT_CODE!